﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace PBO.Data.SQLite.DAL
{
    public static class DALDataDex
    {

        #region move grid

        public static DataTable GetPmMoveGrid(int pmId)
        {
            string sql = "select Name,Type,Category,LearnBy from V_Dex_LearnMove where pmid=" + pmId;
            return SQLiteHelper.DbHelperSQLite.ExecuteDataTable(sql);
        }

        public static DataTable GetLearnGrid(int pmId)
        {
            string sql = "select Name,Type,Category,LearnBy from V_Dex_LearnMove where pmid=" + pmId;
            return SQLiteHelper.DbHelperSQLite.ExecuteDataTable(sql);
        }

        public static DataTable GetMoveGird(string where = "1=1")
        {
            string sql = "select * from V_Move_Grid where " + where;
            return SQLiteHelper.DbHelperSQLite.ExecuteDataTable(sql);
        }

        public static DataTable GetTeamMove(int pid, int type = 0)
        {
            string sql = "select * from V_Team_Move where pid=" + pid;
            if (type != 0)
            {
                sql += " and movetype=" + type;
            }
            return SQLiteHelper.DbHelperSQLite.ExecuteDataTable(sql);
        }

        #endregion

        public static DataTable GetAbilities()
        {
            const string sql = "select id,name,info from pbo_ability where id > 0 order by id";
            var dt = SQLiteHelper.DbHelperSQLite.ExecuteDataTable(sql);
            dt.Columns[0].ColumnName = "ID";
            dt.Columns[1].ColumnName = "名称";
            dt.Columns[2].ColumnName = "简介";
            return dt;
        }

        public static DataTable GetItems()
        {
            const string sql = "select itemid,name,info from pbo_item where itemid > 0 order by itemid";
            var dt = SQLiteHelper.DbHelperSQLite.ExecuteDataTable(sql);
            dt.Columns[0].ColumnName = "ID";
            dt.Columns[1].ColumnName = "名称";
            dt.Columns[2].ColumnName = "简介";
            return dt;
        }

    }
}
